package com.suwenhao.dao;


import com.suwenhao.entity.Menu;
import com.suwenhao.entity.User;
import com.suwenhao.utils.DbUtil;
import org.springframework.jdbc.core.BeanPropertyRowMapper;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author:suwenhao
 * @Description: 测试
 * @Date: Created in 2020/9/22 17:35
 */

public class MenuDao extends BaseDao {

    //    public static void main(String[] args) {
//        listAll().forEach(n -> {
//            System.out.println(n.getName());
//        });
//        System.out.println(getBuId());
//    }
//    public static Menu getBuId(){
//        String sql ="select * from menu where id=?";
//        try {
//
//            return jdbcTemplate.queryForObject(sql,new BeanPropertyRowMapper<>(Menu.class),1);
//        }catch (Exception e){
////            e.printStackTrace();
//            return null;
//        }
//    }
    public List<Menu> listAll() {
        String sql = "select * from menu";
        return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(Menu.class));
    }

}
